home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VMR / VMRMix / SourceInfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  3.2 KB  |  113 lines

  1. //------------------------------------------------------------------------------
  2. // File: SourceInfo.h
  3. //
  4. // Desc: DirectShow sample code
  5. //       Header file and class description for CMediaList, 
  6. //       play-list of media files
  7. //
  8. // Copyright (c) 2000-2001 Microsoft Corporation.  All rights reserved.
  9. //------------------------------------------------------------------------------
  10.  
  11. #if !defined(AFX_SOURCEINFO_H__707CCC42_D3CC_40F1_B722_4E3ED3D7EAFF__INCLUDED_)
  12. #define AFX_SOURCEINFO_H__707CCC42_D3CC_40F1_B722_4E3ED3D7EAFF__INCLUDED_
  13.  
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif // _MSC_VER > 1000
  17.  
  18. //////////////////////////////////////////////////////////////////////////////////////////
  19. // Name: SourceInfo
  20. // Purpose: this class describes properties of media file to be played by VMR
  21. //////////////////////////////////////////////////////////////////////////////////////////
  22. typedef struct SourceInfo  
  23. {
  24.     SourceInfo::SourceInfo() :
  25.                     m_fAlpha(0.5f),
  26.                     m_dwSeekingFlags(NULL),
  27.                     m_fRate(1.0f),
  28.                     m_llDuration(NULL)
  29.  
  30.     {
  31.         m_rD.top = m_rD.left = 0.f;
  32.         m_rD.right = m_rD.bottom = 1.f;
  33.         strcpy( m_szPath, "");
  34.         MultiByteToWideChar(CP_ACP, 0, (const char*)m_szPath, -1, m_wszPath, _MAX_PATH);
  35.     };
  36.  
  37.     SourceInfo::~SourceInfo()
  38.     {
  39.  
  40.     };
  41.  
  42.     bool CopyTo( SourceInfo* pSI)
  43.     {
  44.         if( !pSI )
  45.         {
  46.             return false;
  47.         }
  48.         strcpy( pSI->m_szPath, m_szPath);
  49.         MultiByteToWideChar(CP_ACP, 0, (const char*)m_szPath, -1, pSI->m_wszPath, _MAX_PATH); 
  50.         pSI->m_dwSeekingFlags = m_dwSeekingFlags;
  51.         pSI->m_fAlpha = m_fAlpha;
  52.         pSI->m_fRate = m_fRate;
  53.         pSI->m_llDuration = m_llDuration;
  54.         pSI->m_rD = m_rD;
  55.         return true;
  56.     };
  57.  
  58.     bool            m_bInUse;
  59.     char            m_szPath[MAX_PATH];
  60.     WCHAR           m_wszPath[_MAX_PATH];
  61.     DWORD           m_dwSeekingFlags;
  62.     double          m_fAlpha;
  63.     double          m_fRate;
  64.     LONGLONG        m_llDuration;
  65.     NORMALIZEDRECT  m_rD;
  66.  
  67. } SourceInfo;
  68.  
  69. //////////////////////////////////////////////////////////////////////////////////////////
  70. // Name: CMediaList
  71. // Purpose: List of SourceInfo objects; a storage of available media files 
  72. //          to be played by VMR
  73. //////////////////////////////////////////////////////////////////////////////////////////
  74. class CMediaList
  75. {
  76. public:
  77.     CMediaList();
  78.     virtual ~CMediaList();
  79.  
  80.     int Size(){ return m_N; };
  81.  
  82.     SourceInfo * GetItem( int n) 
  83.     {
  84.         return (n<0 || n>m_N-1) ? NULL : m_ppSI[n];
  85.     };
  86.  
  87.     LONGLONG GetAvgDuration() 
  88.     { 
  89.         return (m_avgDuration);
  90.     };
  91.  
  92.     const WCHAR * GetFileNameW( int n)
  93.     { 
  94.         return (n>=0 && n<m_N) ? m_ppSI[n]->m_wszPath : NULL;
  95.     };
  96.  
  97.     bool Add( SourceInfo * pSI);
  98.     bool Initialize(char *szFolder);
  99.     bool Clone(int n, CMediaList *pML, int nStart=0 );
  100.  
  101.     void Clean();
  102.     void Shuffle();
  103.     void AdjustDuration();
  104.     void SetInitialParameters();
  105.  
  106. private:
  107.     int m_N;
  108.     SourceInfo ** m_ppSI;
  109.     LONGLONG m_avgDuration;
  110. };  
  111. #endif // !defined(AFX_SOURCEINFO_H__707CCC42_D3CC_40F1_B722_4E3ED3D7EAFF__INCLUDED_)
  112.  
  113.